
Component({
  /**
   * 组件的属性列表
   */
  properties: {
      numberStr:{
        type:String,
        value:''
      },
      spaceTag:{
        type:Boolean,
        value:false
      },
      replaceStart:{
        type:Number,
        value:-1
      },
      replaceEnd:{
        type:Number,
        value:-1
      },
  },

  /**
   * 组件的初始数据
   */
  data: {
    numberStrFmt:''
  },

  lifetimes:{
    attached:function(){
      try {
        if(this.data.numberStr != null && 
          this.data.numberStr != '' && 
          this.data.replaceEnd != -1 && 
          this.data.replaceStart != -1){
            let tmpStr = '';
           let tmp = this.data.numberStr;
            var arr = tmp.split('');
            let start = this.data.replaceStart;
            let end = this.data.replaceEnd;
            let stag = this.data.spaceTag;
            arr.forEach(function(a, inx) {
               if(inx >= start &&
                inx < end){
                  tmpStr = tmpStr+"*";
               }else{
                tmpStr = tmpStr+a;
               }
               if(stag && (inx+1)%4===0){
                tmpStr=tmpStr+" ";
               }
            });
           // console.log(tmpStr);
            if(this.data.spaceTag != null && this.data.spaceTag != ''){

            }
           this.setData({numberStrFmt:tmpStr});
        }
      } catch (error) {
        console.log(error);
        this.setData({numberStrFmt:this.data.numberStr});
      }
    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
  }
})